<!DOCTYPE html>
<html>
	<head lang="en">
		<meta charset="UTF-8">
		<title>课工场论坛列表</title>
		<link href="css/bbs.css" rel="stylesheet">
		<script type="text/javascript">
			function fatie(){
				var post=document.getElementById("post1");
				post.style.display="block";
			}
			
			function fabu(){
				var post=document.getElementById("post1");
				post.style.display="none";
				var str1=post.firstElementChild.value;//标题
				var str2="板块：";
				var op=post.children[1].children;
				for(var oo of op){
					if(oo.selected){
						str2+=oo.innerHTML;
						break;
					}
				}
				var time=new Date();
				var year=time.getFullYear();
				var month=time.getMonth();
				var day=time.getDate();
				var hh=time.getHours();
				var mm=time.getMinutes();
				var str3="\t发表时间："+year+"-"+month+"-"+day+" "+hh+":"+mm;				
				
				var i=Math.floor(Math.random()*5);
				var str="images/tou0"+i+".jpg";
				
				var li=document.createElement("li");
				var div=document.createElement("div");
				li.appendChild(div);
				var img=document.createElement("img");
				div.appendChild(img);
				img.setAttribute("src",str);
				var h1=document.createElement("h1");
				li.appendChild(h1);
				h1.innerHTML=str1;
				var p=document.createElement("p");
				li.appendChild(p);
				var span1=document.createElement("span1");
				p.appendChild(span1);
				span1.innerHTML=str2;
				var span2=document.createElement("span2");
				p.appendChild(span2);
				span2.innerHTML=str3;
				
				var ul=document.getElementById("postList");
				ul.appendChild(li);
			}
		</script>
	</head>
	<body>
		<div class="bbs">
			<header><span onclick="fatie()">我要发帖</span></header>
			<section>
				<ul id="postList">
					<li>
						<div><img src="images/tou02.jpg"></div>
						<h1>ggggg</h1>
						<p><span>版块：新手报到</span><span>发表时间：2019-11-18 17:28</span></p>
					</li>
					<li>
						<div>
							<img src="images/tou01.jpg"></div>
						<h1>ddddd</h1>
						<p><span>版块：新课来了</span><span>发表时间：2019-11-18 17:27</span></p>
					</li>
				</ul>
			</section>

			<div class="post" id="post1">
				<input class="title" placeholder="请输入标题（1-50个字符）">
				所属版块：<select>
					<option>请选择版块</option>
					<option>电子书籍</option>
					<option>新课来了</option>
					<option>新手报到</option>
					<option>职业规划</option>
				</select>
				<textarea class="content"></textarea>
				<input class="btn" value="发布" onclick="fabu()">
			</div>
		</div>
	</body>
</html>
